package com.xtaller.easy.admin.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.xtaller.easy.admin.base.TServiceImpl;
import com.xtaller.easy.admin.mapper.SysRoleAuthMapper;
import com.xtaller.easy.admin.model.SysRoleAuth;
import com.xtaller.easy.admin.service.ISysRoleAuthService;
import org.springframework.stereotype.Service;

import java.util.List;
import com.xtaller.common.convert.W;
import com.xtaller.common.bean.Where;
/**
* Created by Taller on 2018/04/13
*/
@Service
public class SysRoleAuthService extends TServiceImpl<SysRoleAuthMapper,SysRoleAuth> implements ISysRoleAuthService {
   /**************************CURD begin******************************/ 
   // 创建
   @Override
   public SysRoleAuth createSysRoleAuth(SysRoleAuth model) {
       if(this.insert(model))
           return this.selectById(model.getId());
       return null;
   }
 
   // 删除
   @Override
   public Boolean deleteSysRoleAuth(Object ids,String reviser) {
       return this.delete(ids,reviser);
   }
 
   // 修改
   @Override
   public SysRoleAuth updateSysRoleAuth(SysRoleAuth model) {
       if(this.update(model))
           return this.selectById(model.getId());
       return null;
   }
 
   // 查询
   @Override
   public List<SysRoleAuth> findByIds(Object ids) {
       return this.selectByIds(ids);
   }
 
   // 属于
   @Override
   public Boolean exist(List<Where> w) {
       w.add(new Where("1"));
       return this.query(w).size() > 0;
   }
 
   // 查询一个id是否存在
   @Override
   public Boolean existId(Object id) {
       where = W.f(
               W.and("id","eq",id),
               W.field("1")
       );
       return this.query(where).size() > 0;
   }


    /**************************CURD end********************************/

    @Override
    public List<SysRoleAuth> getByModuleAndRoleIds(JSONObject where) {
        return null;
    }

}